package com.newlink.building.userinfo.mvp.model

import android.util.Log
import com.newlink.building.common_base.base.BaseModel
import com.newlink.building.common_base.http.Base_RetrofitHelper
import com.newlink.building.common_base.model.bean.*
import com.newlink.building.userinfo.mvp.contract.Module_UserInfo_AccountInformationContract
import io.reactivex.Observable
import okhttp3.MultipartBody

/**
 * @author wangyang
 * @date 2022/9/16
 * @description 我的——账户信息页面的Model
 */
class Module_UserInfo_AccountInformationModel : BaseModel(), Module_UserInfo_AccountInformationContract.Model {

    override fun getUserInfo(token: String, userId: Long): Observable<HttpResult<UserInfoData>> {
        return Base_RetrofitHelper.service.getUserInfo(token, userId)
    }

    override fun getUserInfoNew(token: String, userId: Long): Observable<HttpResult<UserInfoResp>> {
        return Base_RetrofitHelper.service.getUserInfoNew(token, userId)
    }

    override fun setUserInfo(
        token: String,
        setUserInfoBean: SetUserInfoBean
    ): Observable<HttpResult<UserInfoData>> {
        return Base_RetrofitHelper.service.setUserInfo(token, setUserInfoBean)
    }

    //    setUserNickName
    override fun setUserNickName(
        token: String,
        userId: String,
        nickname: String,
    ): Observable<HttpResult<ResponseTopData>> {
        Log.e("jake", ".....setUserNickName.......$nickname")

        return Base_RetrofitHelper.service.setUserNickName(token, userId, nickname)
    }

    override fun uploadAvatar2(
        token: String,
        body: MultipartBody.Part
    ): Observable<HttpResult<AvatarResponse>> {
        return Base_RetrofitHelper.service.uploadAvatar2(token, body)
    }

    override fun deleteAccount(
        token: String,
        userId: String,
        masterFlag: Boolean
    ): Observable<HttpResult<ResponseTopData>> {
        return Base_RetrofitHelper.service.deleteAccount(token, userId, masterFlag)
    }

    override fun syncUserInfo(
        token: String,
        setUserInfoBean: UpdateAvatarBean
    ): Observable<HttpResult<UserInfoData>> {
        return Base_RetrofitHelper.service.syncUserInfo(token, setUserInfoBean)
    }
}